home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / fcntl.man < prev    next >
Encoding:
Text File  |  1989-01-06  |  4.6 KB  |  199 lines

  1.  
  2.  
  3.  
  4. FCNTL                 C Library Procedures                  FCNTL
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      fcntl - file control
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ffccnnttll..hh>>
  13.  
  14.      rreess == ffccnnttll((ffdd,, ccmmdd,, aarrgg))
  15.      iinntt rreess;;
  16.      iinntt ffdd,, ccmmdd,, aarrgg;;
  17.  
  18. DDEESSCCRRIIPPTTIIOONN
  19.      _F_c_n_t_l provides for control over descriptors.  The argument
  20.      _f_d is a descriptor to be operated on by _c_m_d as follows:
  21.  
  22.      F_DUPFD        Return a new descriptor as follows:
  23.  
  24.                     Lowest numbered available descriptor greater
  25.                     than or equal to _a_r_g.
  26.  
  27.                     Same object references as the original
  28.                     descriptor.
  29.  
  30.                     New descriptor shares the same file pointer
  31.                     if the object was a file.
  32.  
  33.                     Same access mode (read, write or read/write).
  34.  
  35.                     Same file status flags (i.e., both file
  36.                     descriptors share the same file status
  37.                     flags).
  38.  
  39.                     The close-on-exec flag associated with the
  40.                     new file descriptor is set to remain open
  41.                     across _e_x_e_c_v(2) system calls.
  42.  
  43.      F_GETFD        Get the close-on-exec flag associated with
  44.                     the file descriptor _f_d.  If the low-order bit
  45.                     is 0, the file will remain open across _e_x_e_c,
  46.                     otherwise the file will be closed upon execu-
  47.                     tion of _e_x_e_c.
  48.  
  49.      F_SETFD        Set the close-on-exec flag associated with _f_d
  50.                     to the low order bit of _a_r_g (0 or 1 as
  51.                     above).
  52.  
  53.      F_GETFL        Get descriptor status flags, as described
  54.                     below.
  55.  
  56.      F_SETFL        Set descriptor status flags.
  57.  
  58.      F_GETOWN       Get the process ID or process group currently
  59.                     receiving SIGIO and SIGURG signals; process
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 22, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FCNTL                 C Library Procedures                  FCNTL
  71.  
  72.  
  73.  
  74.                     groups are returned as negative values.
  75.  
  76.      F_SETOWN       Set the process or process group to receive
  77.                     SIGIO and SIGURG signals; process groups are
  78.                     specified by supplying _a_r_g as negative, oth-
  79.                     erwise _a_r_g is interpreted as a process ID.
  80.  
  81.      The flags for the F_GETFL and F_SETFL flags are as follows:
  82.  
  83.      FNDELAY        Non-blocking I/O; if no data is available to
  84.                     a _r_e_a_d call, or if a write operation would
  85.                     block, the call returns -1 with the error
  86.                     EWOULDBLOCK.
  87.  
  88.      FAPPEND        Force each write to append at the end of
  89.                     file; corresponds to the O_APPEND flag of
  90.                     _o_p_e_n(2).
  91.  
  92.      FASYNC         Enable the SIGIO signal to be sent to the
  93.                     process group when I/O is possible, e.g.,
  94.                     upon availability of data to be read.
  95.  
  96. RREETTUURRNN VVAALLUUEE
  97.      Upon successful completion, the value returned depends on
  98.      _c_m_d as follows:
  99.        F_DUPFD   A new file descriptor.
  100.        F_GETFD   Value of flag (only the low-order bit is defined).
  101.        F_GETFL   Value of flags.
  102.        F_GETOWN  Value of file descriptor owner.
  103.        other     Value other than -1.
  104.      Otherwise, a value of -1 is returned and _e_r_r_n_o is set to
  105.      indicate the error.
  106.  
  107. EERRRROORRSS
  108.      _F_c_n_t_l will fail if one or more of the following are true:
  109.  
  110.      [EBADF]        _F_i_l_d_e_s is not a valid open file descriptor.
  111.  
  112.      [EMFILE]       _C_m_d is F_DUPFD and the maximum allowed number
  113.                     of file descriptors are currently open.
  114.  
  115.      [EINVAL]       _C_m_d is F_DUPFD and _a_r_g is negative or greater
  116.                     than the maximum allowable number (see
  117.                     _g_e_t_d_t_a_b_l_e_s_i_z_e(2)).
  118.  
  119.      [ESRCH]        _C_m_d is F_SETOWN and the process ID given as
  120.                     argument is not in use.
  121.  
  122. SSEEEE AALLSSOO
  123.      close(2), execve(2), getdtablesize(2), open(2), sigvec(2)
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 22, 1986                          2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. FCNTL                 C Library Procedures                  FCNTL
  137.  
  138.  
  139.  
  140. BBUUGGSS
  141.      The asynchronous I/O facilities of FNDELAY and FASYNC are
  142.      currently available only for tty and socket operations.
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0               May 22, 1986                          3
  196.  
  197.  
  198.  
  199.